Thread: Using C++
View Single Post
  #5 (permalink)  
Old Jun 18th, 2006, 05:35
Coty Skaj Coty Skaj is offline
Up'n'Coming Member
Join Date: May 2006
Location: Kentucky
Age: 19
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Using C++

Thanks man, so far I have been practicing the very first basic stuff. I'm working on a making a small test that gives results. For just beginning this stuff today I learn quickly. Here is what I made so far, although its not much at all but an example that I know what I'm doing so far.

Code: Select all
#include <iostream>
using namespace std;

int main()
{
    cout<<"   This is a short test that I put \n";
    cout<<"   together for practice on making\n";
    cout<<"   programs using variables.\n";
    cout<<"\n";
    int qa;
    cout<<"7x8= ";
    cin>> qa;
    cin.ignore();
    
    int qb;
    cout<<"2x3= ";
    cin>> qb;
    cin.ignore();
    if ( qa == 56 && qb == 6 ) {
    cout<<"You got a 100% \n";
}

    else if ( qa == 56 && qb != 6 || qa != 56 && qb == 6 ) {
    cout<<"You got 50% \n";
}    
    int ans = qa * qb  ;
    {
        cout<<"This is your 2 answers multiplied, "<< ans<<".\n";
        }
        cout<<"\n";
        cout<<"If your two answers multiplied equal\n";
        cout<<"336 then you got a 100% on your test.\n";
        cout<<"\n";
    int ansb = ans * 100 ;    
        {
             cout<<"This is your answer if you mulitply\n";
        cout<<"your 2 answers and multiply the answer \n";
        cout<<"from that by 100, "<< ansb<<".\n";
}
        cout<<"\n";
        cout<<"         Made by: Coty Skaj\n";
        
    cin.get();
    return 1;
}
Please tell me anything that I may need to change, or ways that would make this better.

Right now I'm stuck on how I can add more questions and get a percentage for all of it as the grade for the test at the end. Any help would be appreciated. Thanks !!!!!!
Reply With Quote