C++ Math
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: C++ Math

Threaded View

  1. #1
    Join Date
    Mar 2013
    Posts
    4

    C++ Math

    I made a program that asks 18 questions in a do-while loop and then outputs either "correct" or "wrong" for each question. Is it possible to add a formula that will grade the questions that are answered correctly, like how a regular school test is averaged?

    How can I add this to my program? Here's my program:

    #include <iostream>
    #include <string>
    using namespace std;

    string answer;
    char repeat;

    int main()
    {
    do {
    cout<<"Come si dice domani?\n";
    cin>>answer;
    if (answer=="tomorrow" || answer=="Tomorrow")
    cout<<"Correct\n";
    else
    if(answer!="tomorrow"||"Tomorrow")
    cout<<"Sorry"<<endl;
    cout<<"Come si dice aqua?\n";
    cin>>answer;
    if (answer=="water" || answer=="Water")
    cout<<"Correct\n";
    else if(answer!="water"||"Water")
    cout<<"Sorry"<<endl;
    cout<<"Come si dice cibo?\n";
    cin>>answer;
    if (answer=="food" || answer=="Food")
    cout<<"Correct\n";
    else if(answer!="food"||"Food")
    cout<<"Sorry"<<endl;
    cout<<"Vuoi giocare di nuovo?";
    cin>>repeat;
    } while(repeat=='Yes'|| repeat=='yes'||repeat=='si'||repeat=='Si'||repeat=='Y');

    return 0;
    }
    Last edited by gamesun; August 5th, 2013 at 06:42 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center